 <?php
	print("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> \n");
	print("<DKRelations>\n");
	if(!isset($_GET["KID"]))
	{
		print("</DKRelations>\n");
		return;
	}

    $db = mysql_connect("localhost","root","root");
    mysql_select_db("brainway");
    
	$query = "select DID,type
                from datasource_knowledge
                where KID=".$_GET["KID"];
	
	$result = mysql_query($query);
	$num_rows = mysql_num_rows($result);
	
	for( $row_num=0; $row_num < $num_rows; $row_num++)
	{
        $row = mysql_fetch_array($result);
        print("  <DKRelation>\n");
        print("    <DID>".$row["DID"]."</DID> \n");
        print("    <KID>".$_GET["KID"]."</KID> \n");
        print("    <type>".$row["type"]."</type> \n");
        print("  </DKRelation>\n");
	}
	print("</DKRelations>\n");
?>